﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Entity.SingleChain;

namespace Bussiness.SingleChain
{
   public class Generate
    {
        /// <summary>
        /// 生产带有头节点的单链表
        /// </summary>
        /// <param name="minValue"></param>
        /// <param name="maxValue"></param>
        /// <param name="length"></param>
        /// <returns></returns>
        public static Node GenerateRandonList(int minValue, int maxValue, int length)
        {
            Random randon = new Random();
            Node list = new Node();
            Node p = list;
            while (length-- > 0)
            {
                System.Threading.Thread.Sleep(5);
                Node next = new Node(randon.Next(minValue, maxValue));
                p.Next = next;
                p = p.Next;
            }
            return list;
        }
    }
}
